<?php
use Buan\UrlCommand;
?>

<div class="head">
	<h1>Roles</h1>
</div>


<table class="list">
	<caption>Roles</caption>
	<thead>
		<tr>
			<th>Title</th>
			<th>Description</th>
			<th># Users</th>
			<th>Options</th>
		</tr>
	</thead>
	<tbody>
	<?php foreach($roles as $r): ?>
		<tr>
			<td><?php $this->html->e($r->title); ?></td>
			<td><?php $this->html->e($r->description); ?></td>
			<td>
				<?php if($r->_numusers==0): ?>
					-
				<?php else: ?>
					<a href="<?php $this->html->eUrl(UrlCommand::createUrl('scribble', 'auth', 'user', array('filter'=>array('role'=>$r->title)))); ?>"><?php $this->html->e($r->_numusers); ?></a>
				<?php endif; ?>
			</td>
			<td>
				<a href="<?php $this->html->eUrl(UrlCommand::createUrl('scribble', 'auth', 'role', $r->id)); ?>">Edit</a>
			</td>
		</tr>
	<?php endforeach; ?>
	</tbody>
</table>